const express = require("express");
const cors = require("./modules/cors");
const isLogin = require("./modules/isLogin");
const login = require("./routers/login")
const getUserRoute = require("./routers/user/get")
const setUserRoute = require("./routers/user/set")
const setTeamRoute = require("./routers/team/set")
// const xxxRoute = require("./routers/xxx/xxx");

const app = express();

// 注册中间件
app.use( express.static("./www") )
app.use( express.static("./upload") )
app.use( express.urlencoded() )

// 配置跨域
app.all( "*", cors );

app.get("/login", login);

// 配置验证登录状态
app.all( "*", isLogin );

// 功能路由
app.post("/getuser", getUserRoute);
app.post("/setuser", setUserRoute);

app.post("/setteam", setTeamRoute);

app.post("/xxx", xxxRoute);

app.listen(3000, ()=>{
  console.log("开启成功")
})